package com.k136.entity;

import lombok.Data;

/**
 * TODO 类
 *
 * @author LiuTai
 * @version 1.00
 * @Date 2024/9/4
 */
@Data
public class R<T> {
    private String code;
    private String msg;
    private T data;
    public static R ok(Object data){
        R r=new R();
        r.setCode("0000");
        r.setMsg("操作成功");
        r.setData(data);
        return r;
    }
    public static R ok(){
        R r=new R();
        r.setCode("0000");
        r.setMsg("操作成功");
        r.setData(null);
        return r;
    }
    public static R fail(){
        R r=new R();
        r.setCode("1000");
        r.setMsg("操作失败");
        r.setData(null);
        return r;
    }
    public static R fail(String code,String msg){
        R r=new R();
        r.setCode(code);
        r.setMsg(msg);
        r.setData(null );
        return r;
    }

    public static void main(String[] args) {
        R.ok(null);
    }
}
